package org.jeecg.modules.politics.controller;


import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.politics.entity.PoliticsStatus;
import org.jeecg.modules.politics.service.PoliticsStatusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author liujiamiao
 * @email 2544296058@qq.com
 * @since 2020-10-21
 */
@RestController
@RequestMapping("/politics/politics-status")
@Slf4j
@Api(tags = "政治面貌接口")
public class PoliticsStatusController {

    @Autowired
    private PoliticsStatusService politicsStatusService;

    @ApiOperation("获取所有的政治面貌")
    @GetMapping("/list")
    public Result list(){
        List<PoliticsStatus> list = politicsStatusService.list();
        return Result.ok(list);
    }

    @ApiOperation("根据政治面貌id获取政治面貌")
    @GetMapping("/info/{id}")
    public Result info(@ApiParam("政治面貌id") @PathVariable("id")Integer id){
        PoliticsStatus politicsStatus = politicsStatusService.getById(id);
        return Result.ok(politicsStatus);
    }

}

